<?php
/*
 * @分销商城
 * @功能说明：基础类统一集成
 * @更新说明：暂无更新
 * @文件名 ApibaseController.class.php
 * @编码 UTF-8
 * @创建时间 2016-3-16 下午2:57:55
 * @创建人 XING
 */

namespace dg\Controller;

use Think\Controller;
use Think\Hook;
use Think\Think;

class ApibaseController extends Controller
{
    /*
	 * 分销商城_基类初始化
	 * @date: 2016-3-16 下午2:58:39
	 * @editor: XING
	 */
    public function __construct() {
        Hook::listen('action_begin', $this->config);
        //实例化视图类
        $this->view = Think::instance('Think\View');
        //控制器初始化
        if (method_exists($this, '_initialize'))
            $this->_initialize();
        //登陆状态验证
        if (!is_login() && !in_array(get_class($this), C('FiterControl'))) {
            redirect('/user/login');
        }
        $this->auth();
    }

    private function auth() {
        if (session('loginUid')) {
            switch (session('loginUid')) {
                case 7:
                    $menus = array(
                        array(
                            array(
                                'tip'  => '分销管理',
                                'link' => 'javascript:void(0)'
                            ),
                            array(
                                'tip'  => '订单中心',
                                'link' => '/order/index'
                            ),
                            array(
                                'tip'  => '售后订单',
                                'link' => '/order/index/st/refund'
                            ),
                        ),
                        array(

                            array(
                                'tip'  => '用户中心',
                                'link' => 'javascript:void(0)'
                            ),
                            array(
                                'tip'  => '用户管理',
                                'link' => '/index/index',
                            ),
                            array(
                                'tip'  => '卖家审核',
                                'link' => '/saler/index',
                            )
                        ),
                        array(
                            array(
                                'tip'  => '库存发货',
                                'link' => 'javascript:void(0)'
                            ),
                            array(
                                'tip'  => '退货地址',
                                'link' => '/readdres/index',
                            )
                        )
                    );
                    break;
                case 8:
                    $menus = array(
                        array(
                            array(
                                'tip'  => '分销管理',
                                'link' => 'javascript:void(0)'
                            ),
                            array(
                                'tip'  => '商品分类',
                                'link' => '/cate/index'
                            ),
                            array(
                                'tip'  => '商品管理',
                                'link' => '/goods/index/vid/1'
                            ),
                            array(
                                'tip'  => '嗨呗银座专区',
                                'link' => '/goods/index/vid/2'
                            ),
                            array(
                                'tip'  => '订单中心',
                                'link' => '/order/index'
                            ),
                            array(
                                'tip'  => '售后订单',
                                'link' => '/order/index/st/refund'
                            ),
                            array(
                                'tip'  => '考拉商品',
                                'link' => '/kaola/index'
                            ),
                            array(
                                'tip'  => '嘉姐商品',
                                'link' => '/bjie/index'
                            )
                        ),

                        array(

                            array(
                                'tip'  => '用户中心',
                                'link' => 'javascript:void(0)'
                            ),
                            array(
                                'tip'  => '用户管理',
                                'link' => '/index/index',
                            ),
                            array(
                                'tip'  => '卖家审核',
                                'link' => '/saler/index',
                            )
                        ),
                    );
                    break;
                default:
                    $menus = C('menus');
                    break;
            }
            $this->assign('menus', $menus);
        }
    }
}